#include "CApp.h"
 
bool CApp::OnInit()
{
    if(SDL_Init(SDL_INIT_EVERYTHING) < 0)
    {
        return false;
    }
 
    if((Surf_Display = SDL_SetVideoMode(WWIDTH, WHEIGHT, 32, SDL_HWSURFACE | SDL_DOUBLEBUF)) == NULL)
    {
        return false;
    }
    
    if(CArea::AreaControl.OnLoad("./maps/1.area") == false)
    {
        return false;
    }
    
    if(Player.OnLoad("./images/yoshiTwoWay.png", 64, 64) == false)
    {
        return false;
    }
 
    Player.X = 50;
    goombaSpawner.spawnEnemyAtFixedRate(5000);

    CEntity::EntityList.push_back(&Player);
    CEntity::EntityList.push_back(&goombaSpawner);
    CCamera::CameraControl.Mode = TARGET_MODE_CENTER;
    CCamera::CameraControl.SetTarget(&Player.X, &Player.Y);
    
    SDL_EnableKeyRepeat(1, SDL_DEFAULT_REPEAT_INTERVAL / 3);
 
    return true;
}